#include <iostream>
//
// Created by Asus on 2025/5/31.
//
using namespace std;

void demo01() {
    int a1 = 10;
    int b1 = 3;

    cout << a1 + b1 << endl;
    cout << a1 - b1 << endl;
    cout << a1 * b1 << endl;
    cout << a1 / b1 << endl;  //两个整数相除结果依然是整数

    int a3 = 10;
    int b3 = 0;
    // cout << a3 / 0 << endl; //报错，除数不可以为0

    //两个小数可以相除
    double d1 = 0.5;
    double d2 = 0.25;
    cout << d1 / d2 << endl;
}

void demo02() {
    int a = 10;
    a++;
    cout << "a:" << a << endl;

    int b = 10;
    ++b;
    cout << "b:" << b << endl;

    int a2 = 10;
    int b2 = ++a2 * 10;
    int a3 = 10;
    int b3 = a3++ * 10;
    cout << "a2:" << a2 << endl;
    cout << "b2:" << b2 << endl;
    cout << "b3:" << b3 << endl;
    cout << "a3:" << a3 << endl;
}

void demo03() {
    int a = 10;
    int b = 20;

    cout << (a == b) << endl; // 0

    cout << (a != b) << endl; // 1

    cout << (a > b) << endl; // 0

    cout << (a < b) << endl; // 1

    cout << (a >= b) << endl; // 0

    cout << (a <= b) << endl; // 1
}

void demo04() {
    int a = 10;
    if (a) {
        cout << a << endl;
    }
    cout << a << endl;
    cout << !a << endl;
    cout << !!a << endl;
}

void demo05() {
    int a = 10;
    int b = 20;

    cout << (a && b) << endl;

    a = 10;
    b = 0;

    cout << (a && b) << endl;// 0

    a = 0;
    b = 0;

    cout << (a && b) << endl;// 0

    cout << (a || b) << endl;// 1

    a = 10;
    b = 0;

    cout << (a || b) << endl;// 1

    a = 0;
    b = 0;

    cout << (a || b) << endl;// 0
}

int main(char *argv[]) {
    // demo01();
    // demo03();
    // demo03();
    // demo04();
    demo05();
    return 0;
}
